﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

//using System.ComponentModel;
//using System.Data;
//using System.Linq;

namespace CokAracliKontrol
{
    public partial class VehicleParameters : Form
    {
        public MainForm mf = new MainForm();

        public VehicleParameters()
        {
            InitializeComponent();

            cbLeftMotor.SelectedIndex = 1;
            cbRightMotor.SelectedIndex = 2;

            mf.leftMotor = cbLeftMotor.Text;
            mf.rightMotor = cbRightMotor.Text;

            mf.leftMotorPower = 65;
            mf.rightMotorPower = 65;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (cbLeftMotor.Text != cbRightMotor.Text)
            {
                mf.leftMotor = cbLeftMotor.Text;
                mf.rightMotor = cbRightMotor.Text;

                mf.leftMotorPower = Convert.ToInt32(nudLeftMotorPower.Value);
                mf.rightMotorPower = Convert.ToInt32(nudRightMotorPower.Value);

                this.Close();
            }
            else
            {
                MessageBox.Show("Please select different motors for each direction", "Motor Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);            
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}